| Conditions | 1 |
| Paths | 2 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 9 | export function sanitizeAndPrepareWindow(done) { |
||
| 10 | Promise.resolve() |
||
| 11 | .then((function (){ |
||
| 12 | return new Promise(function (resolve) { |
||
| 13 | // Clean up plugin |
||
| 14 | if (window.vm && window.vm.$dialog) { |
||
| 15 | window.vm.$dialog.destroy() |
||
| 16 | } |
||
| 17 | resolve() |
||
| 18 | }) |
||
| 19 | })) |
||
| 20 | .then((function (){ |
||
| 21 | return new Promise(function (resolve) { |
||
| 22 | // clean up app |
||
| 23 | if (window.vm) { |
||
| 24 | let elem = window.vm.$el |
||
| 25 | window.vm.$destroy() |
||
| 26 | window.vm.$off() |
||
| 27 | elem.remove() |
||
| 28 | delete window.vm |
||
| 29 | } |
||
| 30 | resolve() |
||
| 31 | }) |
||
| 32 | })).then(() => { |
||
| 33 | // set them up again |
||
| 34 | window.vm = setupVmWithLocalVue() |
||
| 35 | // Proceed |
||
| 36 | Vue.nextTick(done) |
||
| 37 | }).catch((err) => { |
||
| 38 | done(new Error(err.toString())) |
||
| 39 | }) |
||
| 40 | |||
| 41 | } |
||
| 42 |